#ifndef TRACKER_H
#define TRACKER_H

#include <vector>
#include <opencv2/opencv.hpp>
#include <opencv2/nonfree/features2d.hpp>

class Tracker {
public:
    Tracker();
    ~Tracker();
    bool Execute();
	void SetMouseSpeed(int Value);
	void SetClickSensitivity(int Value);
	void SetDragSensitivity(int Value);
	void SetBlurFilterSensitivity(int Value);
	void SetCalibrated(int Value);
	void SetShowCamera(int Value);
	void SetMovementTreshold(int Value);

private:
    std::vector<cv::KeyPoint> SetSift(cv::Mat & ImgIn);
    void Detect(cv::Mat& Img, cv::Rect& Rectangle, cv::CascadeClassifier &Classifier);
    void Track(cv::Mat& Img, cv::Mat& PartTemplate, cv::Rect& Rectangle);
	void DetectEye(cv::Rect &eyerectangle, cv::CascadeClassifier &eyeclassifier, cv::Mat &frame, cv::Mat &facetemplate);
	void DetectNose(cv::Rect &noserectangle, cv::Mat &face, cv::CascadeClassifier &noseclassifier, cv::Point &zero, cv::Point &previous, cv::Mat &nosetemplate, cv::Rect eyerectangle);
	void MoveMouse(cv::Rect &eyerectangle, cv::Mat &frame, cv::Mat &face, cv::Rect &noserectangle, cv::CascadeClassifier &noseclassifier, cv::Point &zero, cv::Point &previous, cv::Mat &nosetemplate, cv::Point &dif, int &MAX, std::vector<cv::KeyPoint> &keypointsframe, bool &movement, cv::Mat &eyes, int &framecount, int &max, int &min, bool &drag, std::vector<time_t> &tiempos, int &TAM_TIEMPOS, int &posT);
	/* Inicializa las variables por defecto */
	void SetInitialValues();
	/* Velocidad del cursor */
	int mousespeed_;
	/* Sensibilidad del clic */
	int clicksensitivity_;
	/* Sensibilidad de arrastre */
	int dragsensitivity_;
	/* Sensibilidad de difuminar */
	int blurfiltersensitivity_;
	int calibrated_;
	int showcamera_;
	/* Umbral de movimiento */
	int movementtreshold_;
	int TAM_TIEMPOS;
};

#endif // TRACKER_H